<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<%@ page import="com.scalar.chiptrack.utils.ConfigManager" %>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>


<chiptrack:checkLogon sourcePage="/searchPurchaseOrders.do"/>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>

<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">

<script language="javascript">
function submitPage()
{
    var pONumber   = document.receiptSearchForm.poNumber.value;
    var receiptNumber   = document.receiptSearchForm.receiptNumber.value;

    if( pONumber != '')
    {
        if( chkSalesOrderNoBegin ( pONumber ) )
        {
            document.receiptSearchForm.poNumber.focus();
            document.getElementById("errors").innerHTML  = "<br><li>  PO Number should not start with special characters ";
            return false;
        }
        if( chkSalesOrderNo ( pONumber ) == false )
        {
            document.receiptSearchForm.poNumber.focus();
            document.getElementById("errors").innerHTML  = "<br><li>  Please enter Valid PO Number";
            return false;
        }
    }
    if( receiptNumber != '')
    {
        if( chkSalesOrderNoBegin ( receiptNumber ) )
        {
            document.receiptSearchForm.receiptNumber.focus();
            document.getElementById("errors").innerHTML  = "<br><li>  Receipt Number should not start with special characters ";
            return false;
        }
        if( chkSalesOrderNo ( receiptNumber ) == false )
        {
            document.receiptSearchForm.receiptNumber.focus();
            document.getElementById("errors").innerHTML  = "<br><li>  Please enter Valid Receipt Number";
            return false;
        }
    }
	document.receiptSearchForm.action='<%=chipTracContext%>/searchPurchaseOrderReceipts.do?action=search&search=true';
    //document.receiptSearchForm.submit();
    return true;
}

function modify( purchaseOrderReceipt_id )
{
	document.receiptSearchForm.action='<%=chipTracContext%>/purchaseOrderReceipt.do?action=update&receipt_id='+ purchaseOrderReceipt_id;
	document.receiptSearchForm.submit();
}


function showPoForViewPrint( receiptId )
{
    var poViewURL = '<%=chipTracContext%>/purchaseOrderReceipt.do?action=printerFriendly&receiptId='+ receiptId;
    newWindow = window.open (poViewURL,'optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,resizable=yes');
    newWindow.focus();
}
</script>

<!-- Top Header Start-->

<%@ include file="/jsp/includes/header.jsp" %>

<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
	<td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<!-- Side Navigation start -->
<%@include file="/jsp/finance/purchase_order_menu.jsp" %>

<!-- end of the side navigations -->

<TD bgcolor="#ffffff">
<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
<TD valign="top" width="100%">

<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<BR>
<!-- from here your body starts -->
<html:form name="receiptSearchForm" type="com.scalar.chiptrack.finance.openpo.forms.ReceiptSearchForm" action="/searchPurchaseOrderReceipts" onsubmit="javascript:return submitPage()">
    <table border="0" align = "left" width ="100%" >
		<tr><td colspan="5">&nbsp;&nbsp;</td></tr>
		<tr><td colspan="5" align="center" valign="center"><font class="NArialW">
			Receipt Search
		</font></td></tr>
        <tr><td colspan="5"><IMG height=5 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></td></tr>
        <tr><td colspan=5 class="NArialL" align="left"><font color="FF0000"><FONT id="errors"></FONT></font></td></tr>
		<tr><td colspan=5><chiptrack:errors styleClass="NArialL"/></td></tr>
		<tr><td colspan=5><chiptrack:info styleClass="NArialL"/></td></tr>
        <tr><td colspan="5"><IMG height=5 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></td></tr>
        <tr>
            <td>&nbsp;</td>
            <td ><font class = "NArialL">Receipt Number</font></td>
            <td>
				<html:text name="receiptSearchForm" property="receiptNumber" styleClass='txfield' maxlength="50"/>
            </td>
            <td ><font class = "NArialL">PO Number</font></td>
            <td>
				<html:text name="receiptSearchForm" property="poNumber" styleClass='txfield' maxlength="50" />
            </td>
        </tr>
        <tr><td colspan="5"><IMG height=5 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></td></tr>
         <tr>
            <td>&nbsp;</td>
            <td><font class = "NArialL">Vendor Name </font></td>
            <td>
                <html:select name="receiptSearchForm" property="vendor_id" styleClass="txfield">
                    <option value="-1">--Select Vendor-- </option>
                    <html:options collection = "vendorsList" property="value" labelProperty="label"/>
                </html:select>
            </td>
            <td ><font class = "NArialL">Part Number</font></td>
            <td>
				<html:select name="receiptSearchForm" property="processStep_Id" styleClass="txfield">
					<option value="-1">--Select Part Number-- </option>
					<html:options collection = "productList" property="value" labelProperty="label"/>
				</html:select>
            </td>
        </tr>
        <tr><td colspan="5"><IMG height=5 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></td></tr>
        <tr>
            <td>&nbsp;</td>
            <td colspan="2"></td>
            <td><font class = "NArialL">Year </font></td>
            <td>
				<html:select name="receiptSearchForm" property="year" styleClass="txfield">
					<option value="-1">-- All -- </option>
					<html:options collection="yearList" property="label" labelProperty="value"/>
				</html:select>
            </td>
        </tr>
        <tr><td colspan="5"><IMG height=20 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></td></tr>
        <tr>
            <TR align = "center" border="0">
            <TD  bgColor= "" align="center" colspan = '5'>
                <%--<A href="javascript:submit();" ><img border="0" src="<%=chipTracContext%>/jsp/includes/images/search.gif" width="53" height="17" onmouseover="window.status='Click to Search Receipt';return true" onmouseout="window.status='';return true" title="Click here to Search Receipts"></A>&nbsp;&nbsp;&nbsp;--%>
                <input type=image border="0" src="<%=chipTracContext%>/jsp/includes/images/search.gif" width="53" height="17" onmouseover="window.status='Click here to Search Receipts';return true" onmouseout="window.status='';return true" title="Click here to Search Receipts"/>&nbsp;&nbsp;&nbsp;
                <A href="javascript:document.receiptSearchForm.reset()" onMouseOver="window.status='Click to Reset Receipt Search';return true" onMouseOut="window.status='';return true" title="Click to Reset Receipt Search"><IMG border=0 src="<%=chipTracContext%>/jsp/includes/images/reset.gif"></a>
            </TD>
         </TR>
        </tr>
		<tr><td colspan="5" align="left"><font class = "NArialL">To generate new Receipt <a href="<%=chipTracContext%>/searchPurchaseOrderReceipts.do?action=createNewReceipt">Click Here</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td></tr>
		<tr><td colspan="5">&nbsp;</td></tr>
        <tr>
            <td colspan = '5' align = "center">
				<logic:notEmpty name="receiptSearchForm" property="receiptSearchList" >
                <table border="0" width="100%" align="center">
					<tr bgcolor="#993333">
						<td align="center"><font class = "NArialL"><font color = "#FFFFFF">Receipt Number</font></font></td>
						<td align="center"><font class = "NArialL"><font color = "#FFFFFF">PO Number</font></font></td>
						<td align="center"><font class = "NArialL"><font color = "#FFFFFF">Vendor Name</font></font></td>
						<td align="center"><font class = "NArialL"><font color = "#FFFFFF">Receipt Date</font></font></td>
						<td align="center"><font class = "NArialL"><font color = "#FFFFFF">PO Type</font></font></td>
                        <td align="center"><font class = "NArialL"><font color = "#FFFFFF">Receipt Status</font></font></td>
						<td align="center"><font class = "NArialL"><font color = "#FFFFFF">Action</font></font></td>
					</tr>
					<tr class="txfield" >
					<logic:iterate id="receiptOrder" name="receiptSearchForm" property="receiptSearchList" indexId="iteratorIdx" type="com.scalar.chiptrack.finance.openpo.ReceiptOrder">
					<tr <%if(iteratorIdx.intValue()%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%> >
						<td width="15%" align="center">
							<font class="NArialL"><bean:write name="receiptOrder" property="receiptNumber"/></font>
						</td>
						<td width="17%" align="center">
							<font class="NArialL"><bean:write name="receiptOrder" property="purchaseOrderNumber" /></font>
						</td>
                        <td width="17%" align="center">
							<font class="NArialL"><bean:write name="receiptOrder" property="vendorName"/></font>
						</td>
                        <td width="17%" align="center">
							<font class="NArialL"><bean:write name="receiptOrder" property="receiptDate"/></font>
						</td>
                        <td width="17%" align="center">
							<font class="NArialL"><bean:write name="receiptOrder" property="poTypeString"/></font>
						</td>
                        <td width="17%" align="center">
							<font class="NArialL"><bean:write name="receiptOrder" property="status"/></font>
						</td>
                        <td width="17%" align="center" class="NArialL" nowrap="true">
                        <logic:notEqual value="Closed" name="receiptOrder" property="status">
                            <a href="javascript:modify(<bean:write name="receiptOrder" property="receipt_Id"/>);" onmouseover="window.status='Click to Modify Purchase Order Receipt Details';return true" onmouseout="window.status='';return true">
                            Edit
                            </a> &nbsp;&nbsp;&nbsp;
                        </logic:notEqual>
                            
                            <a href="javascript:showPoForViewPrint(<bean:write name="receiptOrder" property="receipt_Id"/>);" onmouseover="window.status='Click to Modify Purchase Order Receipt Details';return true" onmouseout="window.status='';return true">
                            View
                            </a>
                        </td>
					</tr>
					</logic:iterate>
					</tr>
				</table>
				</logic:notEmpty>
            </td>
		</tr>
		<tr>
		<td colspan="5" align="center"><IMG height=50 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></td>
		</tr>
     </table>

</html:form>
<BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>
<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</BODY>
</HTML>
